# BEGIN {
#   # l_dir = File.expand_path('../lib', __FILE__)
#   # t_dir = File.expand_path('../test', __FILE__)
#   # $LOAD_PATH.unshift(l_dir)
#   # $LOAD_PATH.unshift(t_dir)
#   # $LOAD_PATH.uniq!
# }

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'

Rake::TestTask.new("test_units") do |t|
  t.pattern = 'test/**/*_test.rb'
  # t.pattern = 'test/**/auth_test.rb'
  # t.pattern = 'test/**/document_test.rb'
  # t.pattern = 'test/**/media_upload_test.rb'
  # t.pattern = 'test/**/method_test.rb'
  # t.pattern = 'test/**/parameter_test.rb'
  # t.pattern = 'test/**/property_test.rb'
  # t.pattern = 'test/**/schema_test.rb'
  t.verbose = true
  # t.warning = true
end

require File.join(File.dirname(__FILE__), 'lib/spoule', 'version')

PKG_DISPLAY_NAME   = 'Spoule'
PKG_NAME           = 'Spoule'
PKG_VERSION        = Spoule::VERSION::STRING
PKG_FILE_NAME      = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_HOMEPAGE       = 'http://code.google.com/p/spoule/'

RELEASE_NAME       = "REL #{PKG_VERSION}"

PKG_AUTHOR         = 'Christopher Boumenot'
PKG_AUTHOR_EMAIL   = 'boumenot@gmail.com'
PKG_SUMMARY        = 'Package Summary'
PKG_DESCRIPTION    = <<-TEXT
Spoule makes it easy to create JSON schema documents used by Google API services,
or for Google API like-services.
TEXT

PKG_FILES = FileList[
    'lib/**/*', 
    'test/**/*', 
    'tasks/**/*', 
    'vendor/**/*',
    'website/**/*',
    '[A-Z]*', 
    'Rakefile'
].exclude(/database\.yml/).exclude(/[_\.]hg$/)

RCOV_ENABLED = (RUBY_PLATFORM != 'java' && RUBY_VERSION =~ /^1\.8/)
if RCOV_ENABLED
  task :default => 'test_units:verify'
else
  task :default => 'test_units'
end

WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])

Dir['tasks/**/*.rake'].each { |rake| load rake }
